<?php
function litimgurls($imgid=0)
{
    global $lit_imglist,$dsql;
    //获取附加表
    $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c 
                                                            ON a.channel=c.id where a.id='$imgid'");
    $addtable = trim($row['addtable']);
    
    //获取图片附加表imgurls字段内容进行处理
    $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'");
    
    //调用inc_channel_unit.php中ChannelUnit类
    $ChannelUnit = new ChannelUnit(2,$imgid);
    
    //调用ChannelUnit类中GetlitImgLinks方法处理缩略图
    $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']);
    
    //返回结果
    return $lit_imglist;
}

function ajaxReturn($msg = 'success', $errCode = 1, $data = ''){
    $return = [
        'errCode' => $errCode,
        'msg' => $msg,
        'data' => $data
    ];
    echo json_encode($return);
    exit();
}

// 获取会员登陆类,日了真是
function getMemberLogin(){
    require_once(DEDEINC.'/memberlogin.class.php');
    $keeptime = isset($keeptime) && is_numeric($keeptime) ? $keeptime : -1;
    return new MemberLogin($keeptime);
}

/**
 *  其他页面调用模板的头部尾部模板
 *
 * @access    public
 * @param     string  $path  	模板路径
 * @return    string
 */
if(!function_exists('pasterTempletDiy'))
{
    function pasterTempletDiy($path)
    {
        require_once(DEDEINC."/arc.partview.class.php");
        global $cfg_basedir,$cfg_templets_dir,$cfg_df_style;
        $tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$cfg_df_style.'/'.$path;
        $dtp = new PartView();
        $dtp->SetTemplet($tmpfile);
        $dtp->Display();
    }
}

/**
 *
 *
 * @access
 * @param
 * @return
 */
if(!function_exists('getQueryData'))
{
    function getQueryData($query)
    {
        global $lit_imglist,$dsql;
        $dsql->SetQuery($query);
        $dsql->Execute();
        $data['data'] = [];
        while ($row = $dsql->GetArray()){
            $data['data'][] = $row;
        }
        $data['queryString'] = $dsql->queryString;
        $data['error'] = $dsql->GetError();
        return $data;
    }
}